<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Linux系统CPU使用率过高问题排查指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
            border-color: rgba(59, 130, 246, 0.5);
        }
        .section-title {
            position: relative;
            padding-left: 1rem;
        }
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 100%);
            border-radius: 2px;
        }
        .code-block {
            background: #1e293b;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 1rem;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
        }
        .mermaid {
            background: transparent;
            text-align: center;
        }
        .highlight-box {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
            border-left: 4px solid #3b82f6;
            padding: 1.5rem;
            border-radius: 8px;
            margin: 1.5rem 0;
        }
        .floating-icon {
            animation: float 3s ease-in-out infinite;
        }
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
    </style>
</head>
<body class="text-gray-100">
    <!-- Hero Section -->
    <section class="hero-gradient py-20 px-6">
        <div class="max-w-6xl mx-auto text-center">
            <div class="floating-icon inline-block mb-6">
                <i class="fas fa-microchip text-6xl text-white opacity-90"></i>
            </div>
            <h1 class="text-5xl md:text-6xl font-bold text-white mb-6">
                Linux系统CPU使用率过高问题排查指南
            </h1>
            <p class="text-xl md:text-2xl text-blue-100 max-w-3xl mx-auto leading-relaxed">
                深入理解CPU性能瓶颈，掌握系统优化的核心技术，让你的Linux系统运行如飞
            </p>
            <div class="mt-10 flex flex-wrap justify-center gap-4">
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-lg px-6 py-3">
                    <i class="fas fa-chart-line mr-2"></i>
                    <span class="font-semibold">性能监控</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-lg px-6 py-3">
                    <i class="fas fa-tools mr-2"></i>
                    <span class="font-semibold">问题诊断</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-lg px-6 py-3">
                    <i class="fas fa-rocket mr-2"></i>
                    <span class="font-semibold">优化方案</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-7xl mx-auto px-6 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="bg-gray-800 rounded-2xl p-8 card-hover">
                <p class="text-lg leading-relaxed text-gray-300 indent-8">
                    在 Linux 系统中，CPU 使用率过高问题是性能瓶颈排查中的一个常见而关键的难题。对于开发人员和系统管理员来说，理解并分析 CPU 过载情况不仅能帮助定位系统的性能瓶颈，还能为优化应用程序和系统资源的分配提供依据。
                </p>
                <div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
                    <div class="bg-gray-700 rounded-lg p-4 text-center">
                        <i class="fas fa-server text-3xl text-blue-400 mb-2"></i>
                        <h3 class="font-semibold">系统层面</h3>
                        <p class="text-sm text-gray-400 mt-1">内核调度、资源管理</p>
                    </div>
                    <div class="bg-gray-700 rounded-lg p-4 text-center">
                        <i class="fas fa-code text-3xl text-purple-400 mb-2"></i>
                        <h3 class="font-semibold">应用层面</h3>
                        <p class="text-sm text-gray-400 mt-1">程序优化、并发控制</p>
                    </div>
                    <div class="bg-gray-700 rounded-lg p-4 text-center">
                        <i class="fas fa-memory text-3xl text-green-400 mb-2"></i>
                        <h3 class="font-semibold">硬件层面</h3>
                        <p class="text-sm text-gray-400 mt-1">CPU、内存、I/O优化</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- CPU Usage Concepts -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title">CPU使用率基本概念</h2>
            
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
                <div class="bg-gray-800 rounded-xl p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-calculator text-blue-400 mr-3"></i>
                        CPU使用率的计算
                    </h3>
                    <p class="text-gray-300 mb-4">
                        CPU使用率通过计算不同任务执行时间与整个周期的比例来评估系统负载状态。
                    </p>
                    <div class="space-y-2">
                        <div class="flex items-center">
                            <span class="w-24 text-sm text-gray-400">用户态</span>
                            <div class="flex-1 bg-gray-700 rounded-full h-2 ml-3">
                                <div class="bg-blue-500 h-2 rounded-full" style="width: 60%"></div>
                            </div>
                        </div>
                        <div class="flex items-center">
                            <span class="w-24 text-sm text-gray-400">系统态</span>
                            <div class="flex-1 bg-gray-700 rounded-full h-2 ml-3">
                                <div class="bg-purple-500 h-2 rounded-full" style="width: 20%"></div>
                            </div>
                        </div>
                        <div class="flex items-center">
                            <span class="w-24 text-sm text-gray-400">I/O等待</span>
                            <div class="flex-1 bg-gray-700 rounded-full h-2 ml-3">
                                <div class="bg-yellow-500 h-2 rounded-full" style="width: 10%"></div>
                            </div>
                        </div>
                        <div class="flex items-center">
                            <span class="w-24 text-sm text-gray-400">空闲</span>
                            <div class="flex-1 bg-gray-700 rounded-full h-2 ml-3">
                                <div class="bg-green-500 h-2 rounded-full" style="width: 10%"></div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="bg-gray-800 rounded-xl p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-tachometer-alt text-purple-400 mr-3"></i>
                        性能指标解读
                    </h3>
                    <div class="space-y-3">
                        <div class="bg-gray-700 rounded-lg p-3">
                            <div class="flex justify-between items-center">
                                <span class="font-medium">正常状态</span>
                                <span class="text-green-400">40% - 70%</span>
                            </div>
                            <p class="text-sm text-gray-400 mt-1">系统健康，资源利用合理</p>
                        </div>
                        <div class="bg-gray-700 rounded-lg p-3">
                            <div class="flex justify-between items-center">
                                <span class="font-medium">高负载</span>
                                <span class="text-yellow-400">70% - 90%</span>
                            </div>
                            <p class="text-sm text-gray-400 mt-1">需要关注，可能存在瓶颈</p>
                        </div>
                        <div class="bg-gray-700 rounded-lg p-3">
                            <div class="flex justify-between items-center">
                                <span class="font-medium">过载状态</span>
                                <span class="text-red-400">&gt; 90%</span>
                            </div>
                            <p class="text-sm text-gray-400 mt-1">系统过载，需要立即优化</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- CPU Architecture Visualization -->
            <div class="bg-gray-800 rounded-xl p-6 card-hover">
                <h3 class="text-xl font-semibold mb-4">CPU架构与性能关系</h3>
                <div class="mermaid">
                    <pre class="mermaid">
                    graph TB
                        A[CPU核心] --> B[L1缓存]
                        A --> C[L2缓存]
                        C --> D[L3缓存]
                        D --> E[主内存]
                        E --> F[磁盘存储]
                        
                        style A fill:#3b82f6,stroke:#1e40af,color:#fff
                        style B fill:#8b5cf6,stroke:#6d28d9,color:#fff
                        style C fill:#8b5cf6,stroke:#6d28d9,color:#fff
                        style D fill:#8b5cf6,stroke:#6d28d9,color:#fff
                        style E fill:#10b981,stroke:#059669,color:#fff
                        style F fill:#f59e0b,stroke:#d97706,color:#fff
                    </pre>
                </div>
            </div>
        </section>

        <!-- Initial Investigation Methods -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title">初步排查方法</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="bg-gray-800 rounded-xl p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4">
                        <i class="fas fa-terminal text-green-400 mr-2"></i>
                        常用监控工具
                    </h3>
                    <div class="space-y-4">
                        <div class="bg-gray-700 rounded-lg p-4">
                            <h4 class="font-semibold text-blue-400 mb-2">top / htop</h4>
                            <p class="text-sm text-gray-300 mb-2">实时查看系统整体CPU使用情况和进程详情</p>
                            <code class="code-block text-xs">top -o %CPU</code>
                        </div>
                        <div class="bg-gray-700 rounded-lg p-4">
                            <h4 class="font-semibold text-purple-400 mb-2">mpstat</h4>
                            <p class="text-sm text-gray-300 mb-2">分析每个CPU核心的使用率</p>
                            <code class="code-block text-xs">mpstat -P ALL 1</code>
                        </div>
                        <div class="bg-gray-700 rounded-lg p-4">
                            <h4 class="font-semibold text-yellow-400 mb-2">pidstat</h4>
                            <p class="text-sm text-gray-300 mb-2">查看进程级别的资源消耗</p>
                            <code class="code-block text-xs">pidstat -u 1 -p &lt;pid&gt;</code>
                        </div>
                    </div>
                </div>

                <div class="bg-gray-800 rounded-xl p-6 card-hover">
                    <h3 class="text-xl font-semibold mb-4">
                        <i class="fas fa-chart-bar text-yellow-400 mr-2"></i>
                        关键